package com.example.hotel.service.impl;

import com.example.hotel.common.JWTUtil;
import com.example.hotel.dao.LoginDao;
import com.example.hotel.entity.Login;
import com.example.hotel.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    LoginDao loginDao;
    @Override
    public String findLogin(String login_name, String login_pwd) {
        String token = null;
        Login login = loginDao.findLogin(login_name,login_pwd);

        if(login!=null){
            JWTUtil jwtUtil = new JWTUtil();
            token = jwtUtil.getToken(login,3);
        }
        return token;
    }
}
